#ifndef __DEVICE_H__
#define __DEVICE_H__

#include <rtdef.h>

rt_err_t rt_device_init(rt_device_t dev);
rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag);
rt_err_t rt_device_close(rt_device_t dev);
rt_ssize_t rt_device_read(rt_device_t dev,
                         rt_off_t    pos,
                         void       *buffer,
                         rt_size_t   size);
rt_ssize_t rt_device_write(rt_device_t dev,
                          rt_off_t    pos,
                          const void *buffer,
                          rt_size_t   size);
rt_err_t rt_device_control(rt_device_t dev, int cmd, void *arg);
rt_err_t rt_device_set_rx_indicate(rt_device_t dev,
                                   rt_err_t (*rx_ind)(rt_device_t dev,
                                   rt_size_t size));
rt_err_t rt_device_set_tx_complete(rt_device_t dev,
                                   rt_err_t (*tx_done)(rt_device_t dev,
                                   void *buffer));
rt_device_t rt_device_create(int type, int attach_size);
void rt_device_destroy(rt_device_t dev);
rt_device_t rt_device_find(const char *name);
rt_err_t rt_device_unregister(rt_device_t dev);
rt_err_t rt_device_register(rt_device_t dev,
                            const char *name,
                            rt_uint16_t flags);
#endif /* __DEVICE_H__ */
